package net.ojbk.sso.center.service;

import net.ojbk.sso.center.beans.po.User;
import net.ojbk.sso.center.beans.pojo.TokenSystem;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.servlet.http.HttpSession;

/**
 * Created with IntelliJ IDEA.
 * User: twobox
 * Date: 2019/4/8
 * Time: 15:19
 * Description: No Description
 */
@Service
public class SsoService {
    @Autowired
    private TokenSystem tokenSystem;

    public String getUid(String token) throws Exception {
        HttpSession session = tokenSystem.getHttpSession_ByToken(token);
        User user = (User) session.getAttribute("user");
        return user.getUid();
    }
}
